//
//  AlertScene.m
//  WidgetTest
//
//  Created by 李明明 on 15/10/10.
//  Copyright © 2015年 李明明. All rights reserved.
//

#import "AlertScene.h"
#import "AlertBaseScene.h"
@interface AlertScene ()

@end

@implementation AlertScene

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
   // question：当alert出现时，如果statusbar是白色的，statusbar就会显示在alert的上层
    
    // 通过style可以选择是alertview还是actionsheet
    AlertBaseScene *alert = [AlertBaseScene alertControllerWithTitle:@"tip" message:@"content" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"1");
    }];
    UIAlertAction *alertActions = [UIAlertAction actionWithTitle:@"cancle" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSLog(@"2");
        for (UITextField *textfield in alert.textFields) {
            NSLog(@"%@", textfield.text);
        }
    }];
    // textfield只能在alert上用
    [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
        textField.placeholder = @"在此处输入内容";
    }];
    [alert addAction:alertAction];
    [alert addAction:alertActions];
    [self presentViewController:alert animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
